<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>优惠券 - 邦伴用户端</title>
  <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
  <style>
    :root {
      --primary: #ff7e2d;
      --primary-light: #fff3ea;
      --border: #f0f0f0;
      --text-main: #222;
      --text-sub: #888;
    }
    
    body {
      font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
      background-color: #f8f8f8;
      color: var(--text-main);
    }
    
    .app-container {
      width: 375px;
      height: 812px;
      margin: 0 auto;
      background: #fff;
      position: relative;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
      overflow-y: auto;
    }
    
    .primary-color {
      color: var(--primary);
    }
    
    .primary-bg {
      background-color: var(--primary);
    }
    
    .primary-light-bg {
      background-color: var(--primary-light);
    }
    
    .btn-primary {
      background-color: var(--primary);
      color: white;
    }
    
    .btn-outline {
      border: 1px solid var(--primary);
      color: var(--primary);
    }
    
    .tab-active {
      color: var(--primary);
      border-bottom: 2px solid var(--primary);
    }
    
    .coupon {
      position: relative;
      background: white;
      border-radius: 8px;
      overflow: hidden;
      box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }
    
    .coupon::before {
      content: '';
      position: absolute;
      left: -5px;
      top: 50%;
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: #f8f8f8;
      transform: translateY(-50%);
      z-index: 1;
    }
    
    .coupon::after {
      content: '';
      position: absolute;
      right: -5px;
      top: 50%;
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: #f8f8f8;
      transform: translateY(-50%);
      z-index: 1;
    }
    
    .coupon-divider {
      position: absolute;
      left: 0;
      top: 50%;
      width: 100%;
      height: 1px;
      border-top: 1px dashed #e0e0e0;
      z-index: 0;
    }
    
    .coupon-top {
      padding: 16px;
      position: relative;
      z-index: 2;
      background: white;
    }
    
    .coupon-bottom {
      padding: 12px 16px;
      position: relative;
      z-index: 2;
      background: white;
    }
    
    .coupon-expired {
      position: absolute;
      top: 0;
      right: 0;
      width: 80px;
      height: 80px;
      overflow: hidden;
    }
    
    .coupon-expired::before {
      content: '已过期';
      position: absolute;
      width: 120px;
      top: 20px;
      right: -30px;
      transform: rotate(45deg);
      background: rgba(150, 150, 150, 0.8);
      color: white;
      text-align: center;
      padding: 2px 0;
      font-size: 12px;
    }
    
    .coupon-used {
      position: absolute;
      top: 0;
      right: 0;
      width: 80px;
      height: 80px;
      overflow: hidden;
    }
    
    .coupon-used::before {
      content: '已使用';
      position: absolute;
      width: 120px;
      top: 20px;
      right: -30px;
      transform: rotate(45deg);
      background: rgba(150, 150, 150, 0.8);
      color: white;
      text-align: center;
      padding: 2px 0;
      font-size: 12px;
    }
  </style>
</head>
<body>
  <div class="app-container">
    <!-- 顶部导航栏 -->
    <div class="sticky top-0 z-10 bg-white border-b border-gray-100 px-4 py-3 flex items-center">
      <a href="user_center.html" class="mr-2">
        <i class="fas fa-arrow-left text-lg"></i>
      </a>
      <h1 class="text-lg font-medium flex-1 text-center">优惠券</h1>
      <a href="#couponCodeModal" class="text-sm primary-color">
        兑换码
      </a>
    </div>
    
    <!-- 标签页 -->
    <div class="px-4 border-b border-gray-200">
      <div class="flex">
        <div class="tab-active px-6 py-3 text-center">
          <span>可使用</span>
        </div>
        <div class="px-6 py-3 text-center text-gray-500">
          <span>已使用</span>
        </div>
        <div class="px-6 py-3 text-center text-gray-500">
          <span>已过期</span>
        </div>
      </div>
    </div>
    
    <!-- 优惠券列表 -->
    <div class="px-4 py-4">
      <!-- 可使用优惠券 -->
      <div id="usable-coupons">
        <!-- 满减券 -->
        <div class="coupon mb-4">
          <div class="coupon-divider"></div>
          <div class="coupon-top">
            <div class="flex items-center">
              <div class="w-16 h-16 rounded-lg primary-bg flex items-center justify-center text-white mr-3">
                <div class="text-center">
                  <div class="text-xs">¥</div>
                  <div class="text-xl font-bold">50</div>
                </div>
              </div>
              <div class="flex-1">
                <h3 class="font-medium">满300减50</h3>
                <p class="text-xs text-gray-500 mt-1">适用于所有服务</p>
              </div>
            </div>
          </div>
          <div class="coupon-bottom bg-gray-50">
            <div class="flex justify-between items-center">
              <div class="text-xs text-gray-500">有效期至：2023-12-31</div>
              <a href="coupon_detail.html?id=1" class="text-xs primary-color">查看详情</a>
            </div>
          </div>
        </div>
        
        <!-- 折扣券 -->
        <div class="coupon mb-4">
          <div class="coupon-divider"></div>
          <div class="coupon-top">
            <div class="flex items-center">
              <div class="w-16 h-16 rounded-lg bg-blue-500 flex items-center justify-center text-white mr-3">
                <div class="text-center">
                  <div class="text-2xl font-bold">8.5</div>
                  <div class="text-xs">折</div>
                </div>
              </div>
              <div class="flex-1">
                <h3 class="font-medium">家政服务8.5折</h3>
                <p class="text-xs text-gray-500 mt-1">仅限家政保洁服务</p>
              </div>
            </div>
          </div>
          <div class="coupon-bottom bg-gray-50">
            <div class="flex justify-between items-center">
              <div class="text-xs text-gray-500">有效期至：2023-11-30</div>
              <a href="coupon_detail.html?id=2" class="text-xs primary-color">查看详情</a>
            </div>
          </div>
        </div>
        
        <!-- 新人券 -->
        <div class="coupon mb-4">
          <div class="coupon-divider"></div>
          <div class="coupon-top">
            <div class="flex items-center">
              <div class="w-16 h-16 rounded-lg bg-green-500 flex items-center justify-center text-white mr-3">
                <div class="text-center">
                  <div class="text-xs">¥</div>
                  <div class="text-xl font-bold">100</div>
                </div>
              </div>
              <div class="flex-1">
                <h3 class="font-medium">新人专享100元</h3>
                <p class="text-xs text-gray-500 mt-1">首次下单立减100元</p>
              </div>
            </div>
          </div>
          <div class="coupon-bottom bg-gray-50">
            <div class="flex justify-between items-center">
              <div class="text-xs text-gray-500">有效期至：2023-10-31</div>
              <a href="coupon_detail.html?id=3" class="text-xs primary-color">查看详情</a>
            </div>
          </div>
        </div>
      </div>
      
      <!-- 已使用优惠券 -->
      <div id="used-coupons" class="hidden">
        <div class="coupon mb-4">
          <div class="coupon-divider"></div>
          <div class="coupon-top">
            <div class="flex items-center">
              <div class="w-16 h-16 rounded-lg bg-gray-400 flex items-center justify-center text-white mr-3">
                <div class="text-center">
                  <div class="text-xs">¥</div>
                  <div class="text-xl font-bold">30</div>
                </div>
              </div>
              <div class="flex-1">
                <h3 class="font-medium text-gray-500">满200减30</h3>
                <p class="text-xs text-gray-400 mt-1">适用于所有服务</p>
              </div>
            </div>
            <div class="coupon-used"></div>
          </div>
          <div class="coupon-bottom bg-gray-50">
            <div class="flex justify-between items-center">
              <div class="text-xs text-gray-400">使用时间：2023-09-15</div>
              <a href="coupon_detail.html?id=4" class="text-xs text-gray-400">查看详情</a>
            </div>
          </div>
        </div>
      </div>
      
      <!-- 已过期优惠券 -->
      <div id="expired-coupons" class="hidden">
        <div class="coupon mb-4">
          <div class="coupon-divider"></div>
          <div class="coupon-top">
            <div class="flex items-center">
              <div class="w-16 h-16 rounded-lg bg-gray-400 flex items-center justify-center text-white mr-3">
                <div class="text-center">
                  <div class="text-xs">¥</div>
                  <div class="text-xl font-bold">20</div>
                </div>
              </div>
              <div class="flex-1">
                <h3 class="font-medium text-gray-500">满100减20</h3>
                <p class="text-xs text-gray-400 mt-1">适用于所有服务</p>
              </div>
            </div>
            <div class="coupon-expired"></div>
          </div>
          <div class="coupon-bottom bg-gray-50">
            <div class="flex justify-between items-center">
              <div class="text-xs text-gray-400">有效期至：2023-08-31</div>
              <a href="coupon_detail.html?id=5" class="text-xs text-gray-400">查看详情</a>
            </div>
          </div>
        </div>
      </div>
    </div>
    
    <!-- 底部空间 -->
    <div class="pb-20"></div>
    
    <!-- 兑换码弹窗 -->
    <div class="fixed inset-0 bg-black bg-opacity-50 hidden flex items-center justify-center z-20" id="couponCodeModal">
      <div class="bg-white rounded-lg w-80 overflow-hidden">
        <div class="p-4 border-b border-gray-100">
          <h3 class="text-center font-medium">优惠券兑换</h3>
        </div>
        <div class="p-4">
          <div class="mb-4">
            <label class="block text-sm text-gray-600 mb-2">兑换码</label>
            <input type="text" class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:border-primary" placeholder="请输入优惠券兑换码">
          </div>
          
          <div class="flex">
            <button class="flex-1 py-2 border border-gray-300 rounded-lg mr-2" id="cancelRedeem">取消</button>
            <button class="flex-1 py-2 btn-primary rounded-lg">兑换</button>
          </div>
        </div>
      </div>
    </div>
  </div>

  <script>
    document.addEventListener('DOMContentLoaded', function() {
      // 标签页切换
      const tabs = document.querySelectorAll('.px-4.border-b.border-gray-200 .px-6.py-3');
      const contentDivs = [
        document.getElementById('usable-coupons'),
        document.getElementById('used-coupons'),
        document.getElementById('expired-coupons')
      ];
      
      tabs.forEach((tab, index) => {
        tab.addEventListener('click', function() {
          // 移除所有标签的激活状态
          tabs.forEach(t => {
            t.classList.remove('tab-active');
            t.classList.add('text-gray-500');
          });
          
          // 激活当前标签
          this.classList.add('tab-active');
          this.classList.remove('text-gray-500');
          
          // 显示对应内容，隐藏其他内容
          contentDivs.forEach((div, i) => {
            if (i === index) {
              div.classList.remove('hidden');
            } else {
              div.classList.add('hidden');
            }
          });
        });
      });
      
      // 兑换码弹窗
      const redeemLinks = document.querySelectorAll('a[href="#couponCodeModal"]');
      const couponCodeModal = document.getElementById('couponCodeModal');
      const cancelRedeem = document.getElementById('cancelRedeem');
      
      redeemLinks.forEach(link => {
        link.addEventListener('click', function(e) {
          e.preventDefault();
          couponCodeModal.classList.remove('hidden');
          couponCodeModal.classList.add('flex');
        });
      });
      
      cancelRedeem.addEventListener('click', function() {
        couponCodeModal.classList.add('hidden');
        couponCodeModal.classList.remove('flex');
      });
      
      // 点击模态框背景关闭
      document.querySelectorAll('.fixed.inset-0.bg-black.bg-opacity-50').forEach(modal => {
        modal.addEventListener('click', function(e) {
          if (e.target === this) {
            this.classList.add('hidden');
            this.classList.remove('flex');
          }
        });
      });
    });
  </script>
</body>
</html> 